package com.thinkcar.core.enums;

import com.thinkcar.core.exception.api.BaseErrorCode;

/**
 * @author: jiangyong
 * @date: 2025/10/18
 * @description: BaseExceptionEnum
 */
public enum PublicExceptionEnum implements BaseErrorCode {

    SUCCESS("000000", "操作成功"),
    ARGUMENT_NOT_VALID("000001", "请求参数校验不通过"),
    OPERATE_SERVICE_ERROR("000002", "服务操作异常:{}"),
    NULL_POINTER_EXCEPTION("000003", "空指针异常:{}"),
    RESOURCE_NOT_FOUND("000004", "资源未找到"),
    //RestTemplate-0001XX
    RESTTEMPLATE_GET_FAIL("000101", "GET请求失败 - URL: {}, 错误: {}"),
    RESTTEMPLATE_POST_FAIL("000102", "POST请求失败 - URL: {}, 错误: {}"),
    RESTTEMPLATE_POST_FORM_FAIL("000103", "POST表单请求失败 - URL: {}, 错误: {}"),
    RESTTEMPLATE_REQUEST_INTERRUPTED("000104", "请求被中断, 错误: {}"),
    RESTTEMPLATE_EXCEPTION("000105", "[{}]方法请求失败, 错误: {}"),
    RESTTEMPLATE_RETRY_EXHAUSTED("000106", "[{}]请求重试次数用尽, 错误: {}"),
    RESTTEMPLATE_RESPONSE_ERROR("000107", "HTTP响应错误: {}"),


    FAIL("999999", "操作失败");

    /**
     * 错误码
     */
    private final String code;

    /**
     * 错误描述
     */
    private final String msg;

    PublicExceptionEnum(String code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    @Override
    public String getCode() {
        return code;
    }

    @Override
    public String getMsg() {
        return msg;
    }
}
